import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import Home from '../views/Home.vue'
import BrandList from '../views/admin/admin-brand.vue'
import SpecificationList from '../views/admin/admin-specification.vue'
import AdminCategory from '../views/admin/admin-category.vue'
import AdminTemplate from '../views/admin/admin-template.vue'
import AdminGoods from '../views/admin/admin-goods.vue'
import AdminContent from '../views/content/admin-content.vue'
import Login from '../views/Login.vue'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'Login',
    component: Login
  },
  {
    path: '/home',
    name: 'Home',
    component: Home,
    children:[
      {
        path: '/admin/Brand',
        name: 'BrandList',
        component: BrandList
      },
      {
        path: '/admin/SpecificationList',
        name: 'admin-specification',
        component: SpecificationList
      },
      {
        path: '/admin/category',
        name: 'AdminCategory',
        component: AdminCategory
      },
      {
        path: '/admin/template',
        name: 'AdminTemplate',
        component: AdminTemplate
      },
      {
        path: '/admin/goods',
        name: 'AdminGoods',
        component: AdminGoods
      },
      {
        path: '/content/adminContent',
        name: 'AdminContent',
        component: AdminContent
      }
    ]
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
